home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc302emb.zip / LIBCF / STRING4.ASM < prev    next >
Assembly Source File  |  1994-03-18  |  355b  |  15 lines

  1. *
  2. * Search for character in string: strchr(string, chr)
  3. *
  4. strchr    LDI    4,S        Get pointer to string
  5. ?1    LDB    I        Get character from string
  6.     JZ    ?2        End of string
  7.     CMP    2,S        Does it match?
  8.     JNZ    ?3        Yes, we found it
  9.     LEAI    1,I        Skip to next
  10.     SJMP    ?1        No, keep looking
  11. ?2    CMP    2,S        Are we looking for zero
  12.     JZ    ?4        No, return 0
  13. ?3    TIA            Get pointer
  14. ?4    RET
  15.